package cn.yuanqiao.feignService;

import cn.yuanqiao.common.constant.UserConstants;
import cn.yuanqiao.common.core.domain.AjaxResult;
import cn.yuanqiao.common.core.domain.BusinessActivity;
import cn.yuanqiao.common.core.domain.R;
import cn.yuanqiao.common.core.domain.entity.SysDept;
import cn.yuanqiao.common.core.domain.entity.SysRole;
import cn.yuanqiao.common.core.domain.entity.SysUser;
import cn.yuanqiao.common.core.domain.model.LoginUser;
import cn.yuanqiao.common.utils.SecurityUtils;
import cn.yuanqiao.common.utils.StringUtils;
import cn.yuanqiao.system.domain.SysLogininfor;
import cn.yuanqiao.system.domain.SysOperLog;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import static cn.yuanqiao.common.core.domain.AjaxResult.success;

/**
 * @ProjectName: cn.yuanqiao.feignService
 * @ClassName: ApiSystemServer
 * @Author: lenovo
 * @Description: hbWang
 * @Date: 2024/7/8 17:24
 * @Version: 1.0
 **/
public interface ApiSystemService {
    /**
     * 根据参数键名查询参数值
     */
    public R<AjaxResult> getConfigByKey(String configKey) ;

    public R<String> getConfigByKeyTenantCode(String configKey, String tenantCode) ;

    /**
     * 新增操作日志
     *
     * @param sysOperLog
     * @return
     * @throws Exception
     */
    public R<Boolean> saveLog(SysOperLog sysOperLog) throws Exception ;

    public R<Boolean> saveBusinessBehavior(BusinessActivity businessActivity) throws Exception ;


    public R<Boolean> saveLogininfor(SysLogininfor sysLogininfor) ;

    /**
     * 通过用户名查询用户信息
     *
     * @return 结果
     */
    public R<Boolean> copySysMenu(String tenantCode) ;

    /**
     * 删除菜单
     *
     * @param tenantCode
     * @return
     */
    public R<Boolean> deleteMenuByTenantCode(@PathVariable("tenantCode") String tenantCode);

    /**
     * 获取三员列表
     *
     * @param isSanyuan
     * @param tenantCode
     * @return
     */
    public R<Long[]> getTemplateMenuIds(String isSanyuan, String tenantCode);
    /**
     * 获取部门详情
     *
     * @param deptId
     * @return
     */
    public R<SysDept> getInfoApi(Long deptId) ;

    /**
     * 部门同步
     *
     * @param dept
     * @return
     */
    public R<SysDept> addAsync(SysDept dept) ;

    /**
     * 查询部门信息
     *
     * @param deptName
     * @param tenantCode
     * @return
     */
   /* public R<SysDept> getParentAsync(String deptName, String tenantCode) {
        SysDept dept = deptService.selectDeptByName(deptName, tenantCode);
        return R.ok(dept);
    }*/

    /**
     * 修改部门
     *
     * @param dept
     * @return
     */
    public R<Integer> editAsync(SysDept dept) ;

    /**
     * 删除部门
     *
     * @param deptId
     * @return
     */
    public R<Integer> removeAsync(Long deptId) ;

    /**
     * 查询子节点信息
     *
     * @param deptName
     * @param tenantCode
     * @return
     */
    public R<List<SysDept>> getDeptListByDeptName(String deptName, String tenantCode) ;
    /**
     * 通过用户名查询用户信息
     *
     * @param username
     * @param tenantcode
     * @return
     */
    public R<LoginUser> getUserInfo(String username, String tenantcode) ;

    /**
     * 用户详细信息
     *
     * @param id
     * @return
     */
    public R<LoginUser> infoById(Long id) ;


    R<LoginUser> infoByOId(String oId) ;
    /**
     * 注册用户信息
     *
     * @param sysUser
     * @return
     */
    public R<Boolean> registerUserInfo(SysUser sysUser) ;
    /**
     * 新增角色信息
     *
     * @param list
     * @return
     */
    public R<String> addSysRoles(List<SysRole> list);

    /**
     * 新增用户信息
     *
     * @param list
     * @return
     */
    public R<String> addSysUsers(List<SysUser> list);
    /**
     * 查询用户信息
     *
     * @param roleKey
     * @return
     */
    public R<String> getMenuPermission(String roleKey) ;

    /**
     * 删除租户信息
     *
     * @param tenantCode
     * @param source
     * @return
     */
    public R<String> deleteTenantAbout(String tenantCode, String source) ;

    /**
     * 查询用户信息
     *
     * @param roleKey
     * @param deptId
     * @param tenantCode
     * @return
     */
    public R<List<SysUser>> selectSysUserByRoleKeyAndDeptId(String roleKey, String deptId, String tenantCode) ;
    /**
     * 查询用户信息
     *
     * @param roleKey
     * @param tenantCode
     * @return
     */
    public R<List<SysUser>> selectSysUserByRoleKey(String roleKey, String tenantCode) ;
    /**
     * 用户同步
     *
     * @param user
     * @return
     */
    public R<SysUser> addAsync(SysUser user);

    /**
     * 用户修改
     *
     * @param user
     * @return
     */
    public R<Integer> editAsync(SysUser user);

    /**
     * 查询用户信息
     *
     * @param nickName
     * @param tenantcode
     * @return
     */
    public R<List<SysUser>> getUserByNickName(String nickName, String tenantcode) ;
    /**
     * 删除用户信息
     *
     * @param userId
     * @return
     */
    public R<Integer> removeAsyncUser(Long userId) ;
    /**
     * 查询角色信息
     *
     * @return
     */
    public R<List<SysRole>> selectSysRoleList() ;

    R<String> getAllMenuByRole(String roleId);

    R<Map<String, String>> selectHmacByRoleId(String roleId) ;

    R changeStatusApi(@RequestBody SysUser user) ;
}
